package chp07.homework;

import java.util.Arrays;

public class Home6 {

    public static void main(String[] args) {
        int[] array = {1,3,-1,5,-2};
        System.out.println("原数组:");
        System.out.println(Arrays.toString(array));

        int[] newArray = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            int j = array.length - i - 1;
            if(array[i] < 0){
                newArray[j] = 0;
            }else {
                newArray[j] = array[i];
            }
        }
        System.out.println("逆序拷贝的数组");
        System.out.println(Arrays.toString(newArray));


    }
}
